﻿<UserControl x:Class="DogsModule.Views.DogList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:prism="http://prismlibrary.com/"             
             prism:ViewModelLocator.AutoWireViewModel="True">
    <UserControl.Resources>
        <Style TargetType="TextBlock" BasedOn="{StaticResource ResourceKey=MetroTextBlock}">
            <Setter Property="FontSize" Value="20" />
            <Setter Property="MaxWidth" Value="400" />
            <Setter Property="TextWrapping" Value="Wrap" />
        </Style>
    </UserControl.Resources>
    <StackPanel>
        <TextBlock>Click on the Edit Dog buttons below to open the flyout and edit the dog.  Only a single flyout is present - the dog to edit is passed to the flyout's view model 
        using FlyoutParameters.  You can see this in action with the Flyout's header, which includes the dog's name.  We can set any IFlyout property we like within the OnOpening method allowing us to vary theme, position etc. based on the FlyoutParameters passed in.  Position change is demonstrated for "Patch".</TextBlock>
        <TextBlock>The Flyout is opened via a command on the button - the associated method calls OpenFlyout on the FlyoutManager.</TextBlock>
        
        <ListBox ItemsSource="{Binding DogList}" MaxWidth="400">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel MaxWidth="400" Margin="20">
                        <TextBlock>Name:</TextBlock>
                        <TextBlock Text="{Binding Name}" />
                        <TextBlock>Breed:</TextBlock>
                        <TextBlock Text="{Binding Breed}" />
                        <TextBlock>Age:</TextBlock>
                        <TextBlock Text="{Binding Age}" />
                        <Button 
                        Command="{Binding DataContext.EditDogCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
                        CommandParameter="{Binding}">
                            Edit Dog
                        </Button>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </StackPanel>
    
</UserControl>
